/*
 * @Description: 
 * @Author: Jimmy
 * @Date: 2023-07-23 21:41:26
 * @LastEditTime: 2023-07-26 19:39:10
 * @LastEditors:  
 */
import { Sequelize } from "sequelize";
import { config } from "../config/config.default";

const seq = new Sequelize(config.db.name as string, config.db.user as string, config.db.password as string, {
    host: config.db.host,
    port: config.db.port as unknown as number,
    dialect: 'mysql',
    timezone: '+08:00', // 慢几小时就加几小时
    dialectOptions:{
        dateStrings:true,
        typeCast:true
    }
})

// seq.authenticate().then(res=>{
//     console.log('数据库连接成功')
// }).catch(err=>{
//     console.log('数据库连接失败',err)
// })

export default seq;